package neu.soft.feignclient;


import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import neu.soft.entity.Invoice;
import neu.soft.vo.ResultBean;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class FinacialFeignClientFallBackFactory implements FallbackFactory<FinancialFeignClient> {
    @Override
    public FinancialFeignClient create(Throwable throwable) {
        return new FinancialFeignClient() {
            @Override
            public ResultBean<Invoice> add(Map<String, Object> map) {
                return ResultBean.error(500,throwable.getMessage());
            }

            @Override
            public ResultBean<Invoice> get(String orderId) {
                return ResultBean.error(500,throwable.getMessage());
            }
        };
    }

}